package mesh

import (
	"cgs-server/server/model"
	"go.mongodb.org/mongo-driver/bson/primitive"
	"time"
)

// Model is mesh model.
type Model struct {
	model.BaseModel `json:"-" bson:",inline"`

	// ID
	ID string `bson:"ID"`
	// Name
	Name string `bson:"Name"`
	// Category ID
	CategoryID string `bson:"CategoryID"`
	// Category Name
	CategoryName string `bson:"CategoryName"`
	// Total PinYin
	TotalPinYin string `bson:"TotalPinYin"`
	// The First Letters of Total PinYin
	FirstPinYin string `bson:"FirstPinYin"`
	// Mesh Type
	Type string `bson:"Type"`
	// Download URL
	URL string `json:"Url" bson:"Url"`
	// File Name
	FileName string `bson:"FileName"`
	// File Size
	FileSize int64 `bson:"FileSize"`
	// File Type
	FileType string `bson:"FileType"`
	// Save Name
	SaveName string `bson:"SaveName"`
	// Save Path
	SavePath string `bson:"SavePath"`
	// Upload Time
	AddTime time.Time `bson:"AddTime"`
	// Thumbnail
	Thumbnail string `bson:"Thumbnail"`

	// IsInternal 是否是内置模型
	IsInternal bool `json:"isInternal" bson:"isInternal"`
}

func (m *Model) SetId(id primitive.ObjectID) {
	m.ID = id.String()
}

func (m *Model) GetId() string {
	return m.ID
}

type ZipFile struct {
	Filename string
	Size     int64
	FileType string
	Content  []byte
}
